package com.xhwl.data.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xhwl.common.pojo.cent.sdata.Account;
import com.xhwl.common.pojo.cent.sdata.App;
import com.xhwl.common.pojo.cent.sdata.Permission;
import com.xhwl.common.pojo.cent.sdata.RolePermission;

import java.util.List;

/**
 * @description:
 * @author:
 * @create: 2020-11-25
 **/
public interface IRolePermissionService extends IService<RolePermission> {


    /**
     * 新增角色权限 关联关系
     *
     * @param roleId
     * @param permissionIdList
     */
    void createRolePermission(Integer roleId, List<Integer> permissionIdList);

    /**
     * 删除角色权限  关联关系
     *
     * @param roleIdList
     * @param permissionIdList
     */
    void deleteRolePermission(List<Integer> roleIdList, List<Integer> permissionIdList);


    /**
     * 根据角色id查找权限list
     *
     * @param roleIdList
     * @return
     */
    List<Integer> getPermissionIdByRoleId(List<Integer> roleIdList);

    List<Permission> getPermissionByRoleId(List<Integer> roleIdList);

    /**
     * 根据权限list查找角色list
     *
     * @param permissionIdList
     * @return
     */
    List<Integer> getRoleByPermission(List<Integer> permissionIdList);


    List<Permission> getSuperManagerPermission(Account account);

    List<Permission> getEnterpriseManagePermission(Account account);

    /**
     * 普通账号获取权限 list 根据企业，项目权限取交集
     * @param project
     * @param account
     * @param app
     * @return
     */
    List<Permission> getCommonAccountPermission(Integer project, Account account, App app);


}
